/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.sunspotworld;

/**
 *
 * @author me
 */
public class Consumer extends Thread {
    int CTRIALS = 100;
    int CDELAY =22;        //ms

    BoundedBuffer bb;

    Consumer(BoundedBuffer bb)
    {
        this.bb = bb;
    }

    public void run(){
        try
        {
           for (int i = 0; i < CTRIALS; i++)
           {
            int stuff = bb.get();
            System.out.println("Consume: " +stuff);
            Thread.sleep(CDELAY);
            }
        } catch (InterruptedException e) {System.out.println( "Consumer " );
        }
    }
}